import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { PipeVerifyService } from './pipe-verify.service';
import { CreatePipeVerifyDto } from './dto/create-pipe-verify.dto';
import { UpdatePipeVerifyDto } from './dto/update-pipe-verify.dto';

// 引入管道验证
import { PipeVerifyPipe } from './pipe-verify/pipe-verify.pipe';

@Controller('pipe-verify')
export class PipeVerifyController {
  constructor(private readonly pipeVerifyService: PipeVerifyService) {}

  // 通过修饰器实现管道校验
  @Post('test1')
  test1(@Body(PipeVerifyPipe) body: CreatePipeVerifyDto) {
    return body;
  }

  // 使用 nestjs 自带 ValidationPipe
  @Post('test2')
  test2(@Body() body: CreatePipeVerifyDto) {
    return body;
  }
}
